//直接引入（test.html） <script src="components/pagination2.js"></script>
Vue.component('pagination', {
    props: {
        page: {
            type: Number,
            required: true
        },
        size: {
            type: Number,
            required: true
        },
        total:{
            type: Number,
            required: true
        }
    },
    template: `<div>
        <el-pagination
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :current-page="page"
          :page-sizes="[5, 10, 15]"
          :page-size="size"
          layout="sizes, prev, pager, next, jumper"
          :total="total">
        </el-pagination>
     </div>    
    `,
    methods: {
        handleSizeChange(size) {
            this.$emit('page-change', 1, size);
        },
        handleCurrentChange(page) {
            this.$emit('page-change', page, this.size);
        }
    }
});
